Skip to content

CLN: Added static types #33126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 3, 2020

Conversation

ShaharNaveh
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@@ -591,6 +579,9 @@ cdef class TextReader:
self.parser.quotechar = ord(quote_char)

cdef _make_skiprow_set(self):
cdef:
int64_t i

if isinstance(self.skiprows, (int, np.integer)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

util.is_integer

@@ -591,6 +579,9 @@ cdef class TextReader:
self.parser.quotechar = ord(quote_char)

cdef _make_skiprow_set(self):
cdef:
int64_t i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anything that is used to index Python objects you should opt for Py_ssize_t

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, my reason to have this as int64_t is because below we have the line:

            for i in self.skiprows:
                parser_add_skiprow(self.parser, i)

Which calls parser_add_skiprow, parser_add_skiprow is defined here:

int parser_add_skiprow(parser_t *self, int64_t row)

and i is in the place of row, I tried to match the type, to avoid (potential) casting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should also be a Py_ssize_t; I don't know what effort it would require to update that but OK to split off on a separate PR too

@WillAyd WillAyd added the Clean label Mar 30, 2020
@jbrockmendel
Copy link
Member

LGTM

@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Apr 2, 2020
@WillAyd
Copy link
Member

WillAyd commented Apr 3, 2020

@jreback here as well; I think good to merge

@jreback jreback merged commit 7fb878a into pandas-dev:master Apr 3, 2020
@jreback
Copy link
Contributor

jreback commented Apr 3, 2020

thanks @MomIsBestFriend

@ShaharNaveh ShaharNaveh deleted the CLN-vars-type-_libs-parsers branch April 6, 2020 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants